#版本号
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)

#指定编译器
#SET(CMAKE_C_COMPILE "/usr/bin/gcc")
SET(CMAKE_CXX_COMPILE "/usr/bin/g++")

#工程名称
PROJECT(Processor)

#指定编译模式
set(CMAKE_BUILD_TYPE "Debug")

#指定使用C++11
set(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_STANDARD 11)

 #添加编译参数
 set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")    #-O0不做任何优化，-ggdb生成调试信息，
 set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}-pthread") #多线程

#指定头文件地址
INCLUDE_DIRECTORIES(
    boost 
    ${PROJECT_SOURCE_DIR}/include
    ${PROJECT_SOURCE_DIR}/include/mysql
    ${PROJECT_SOURCE_DIR}/include/machine
    ${PROJECT_SOURCE_DIR}/include/config
    ${PROJECT_SOURCE_DIR}/include/thread
    )

#添加库文件夹
LINK_DIRECTORIES(
    /usr/local/lib
    /usr/lib64/mysql
    /usr/lib64
    )

#设置程序输出目录
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#添加源文件目录
#file(GLOB SRCS_G "src/*.cpp")
ADD_SUBDIRECTORY(src)


#源文件


#生成可执行文件
add_executable(${PROJECT_NAME} main.cpp)
#add_library(${PROJECT_NAME} STATIC ${SRC_LIST})
#add_library(${PROJECT_NAME} SHARED ${SRC_LIST})

#添加库
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} pthread)                 #多线程
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} libboost_thread.a)      #boost.thread
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} libboost_log_setup.a)    #boost.log//
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} libboost_locale.a)
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} libboost_log.a)
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} libboost_filesystem.a)   #boost.filesystem
TARGET_LINK_LIBRARIES(${PROJECT_NAME} libboost_filesystem.a)   #boost.filesystem
TARGET_LINK_LIBRARIES(${PROJECT_NAME} dl)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} pthread)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} libssl.so)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} libcrypto.so)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} libmysqlclient.so)        #mysql客户端库,不能用静态库？？？？
TARGET_LINK_LIBRARIES(${PROJECT_NAME} config machine mysql thread)